package com.session01;

import java.util.Scanner;
import java.util.Arrays;

public class Demo5 {
    public static void main(String[] args) {
        int[] arr = new int[5];
        Scanner num = new Scanner(System.in);
        double sum = 0;
        for (int i = 0; i < arr.length; i++) {
            arr[i] = num.nextInt();
            sum += arr[i];
        }
        double x = sum / 5;
        System.out.println("最高分为：" + max(arr));
        System.out.println("最低分为：" + min(arr));
        System.out.println("平均分为：" + x);
        for (int i = 0; i < arr.length; i++) {
            double temp = arr[i] - x;
            System.out.print("第" + (i + 1) + "个学生与平均分的差值为：");
            System.out.printf("%.2f",temp);
            System.out.println("");
        }
        Arrays.sort(arr);
        for (int i = arr.length - 1; i >= 0; i--) {
            System.out.print(arr[i] + " ");
        }
    }

    public static int max(int[] arr) {
        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
        }
        return max;
    }

    public static int min(int[] arr) {
        int min = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (min > arr[i]) {
                min = arr[i];
            }
        }
        return min;
    }
}
